<template>
    <div class="flex-row-center base-size mb20 pointer">
        <a class="home_icon" href="https://zhyq.ailuquan.cn/website/shijzslqqzf">首页</a>
        <span class="ml5 mr5">></span>
        <span @click="proxy.routerBackMixin" class="base-color">金融政策</span>
        <span class="ml5 mr5">></span>
        <span class="">详情</span>
    </div> 
    <div>
        <div class="size24 weight mb10">{{detail.title||""}}</div>
        <div class="flex-row-center base-gray-size">
            <span class="mr30">发布时间：{{detail.sendtime||''}}</span>
            <span class="mr30">类别：{{proxy.$utils.findObj(detail.type,types,'id').name}}</span>
            <span>阅读数：{{detail.num}}</span>
        </div>
        <div class="line mt10 mb30"></div>
        <div v-html="detail.msg"></div>
    </div>
</template>
<script setup>
    import { reactive,ref,getCurrentInstance,toRaw,inject,toRefs } from 'vue'
    let { proxy } = getCurrentInstance()
    let obj = reactive({
        detail:{
            id: proxy.$route.query.id
        },
        types: []
    })

    // 获取政策类别
    proxy.$utils.getFinancialPolicyType(proxy).then(res=>{
        types.value = res;
    })
    let init = ()=>{
        proxy.$ajax({url: 'financialpolicy/get',data:{policy_id: obj.detail.id},bfLoading: true}).then(d => {
            if(d.success){
                obj.detail = {
                    ...d.msg,
                    id: obj.detail.id
                }
            }else{}
        }).catch(e => {
            console.log(e)
            if(e == "登录已过期，请重新登录"){
                proxy.routerPushMixin('/')
            }
        })
    }
    init()

    let { detail,types } = toRefs(obj)
</script>

<style lang="scss" scoped>
</style>